home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
ab20
/
ab20_archive
/
datacomm
/
vlt-fkeys-0.51.lzh
/
VLT_FKeys.vlt
< prev
Wrap
Text File
|
1990-08-16
|
7KB
|
272 lines
/************************************************************************/
/* VLT_FKeys v0.51 08/16/90 */
/* */
/* VLT_FKeys - (c) Copyright Michael Scott Velez 1990. */
/* */
/* You may distribute this program as long as it is not sold for */
/* profit, and is contained in the original archive. */
/* */
/* VLT_FKeys enables to you to interactively edit 50 of VLT's */
/* function keys definitions (normal, shifted, alt, ctrl & user). */
/* Place this in your REXX: directory, start VLT, and run as */
/* an 'Arexx Script'. Have fun... */
/* */
/* */
/* Questions, suggestions or complaints may be sent to: */
/* */
/* BIX: mvelez or Michael Scott Velez */
/* 1014 West 7th Ave. */
/* Vancouver, BC */
/* V6H 1B3 */
/* */
/************************************************************************/
Title = 'VLT_FKeys v0.51'
Author = 'Michael Scott Velez'
TRUE = 1
FALSE = ~TRUE
/* we need these libraries */
if (~show('l', "rexxarplib.library")) then do
call addlib('rexxarplib.library', 0, -30, 0)
end
if (~show('l', "rexxsupport.library")) then do
call addlib('rexxsupport.library', 0, -30, 0)
end
/* you don't *need* WShell to run this, but get it. It's worth it! */
if (exists("C:RunWSH")) then
Shell = 'C:RunWSH'
else
Shell = 'C:Run'
/* start host */
if (ScreenCols('VLT') == -1) then /* running in Workbench window */
xhost = 'rx "call CreateHost(FHOST, FPORT,)"'
else
xhost = 'rx "call CreateHost(FHOST, FPORT, ' || address() || ')"'
address command Shell xhost
/* wait for it to load and init itself */
do 50 while ~show('Ports', 'FHOST')
call delay(10) /* 1/10th sec */
end
/* set up our boolean gadgets */
Boolean.Num = 5
do i = 1 to Boolean.Num
Boolean.LeftEdge.i = ((i - 1) * 96) + 36
Boolean.TopEdge.i = 15
Boolean.GadgetID.i = i /* how we tell one gadget from another */
end
Boolean.Text.1 = ' Normal '
Boolean.Type.1 = 'f'
Boolean.Text.2 = ' Shifted '
Boolean.Type.2 = 'F'
Boolean.Text.3 = ' CTRL '
Boolean.Type.3 = 'C'
Boolean.Text.4 = ' ALT '
Boolean.Type.4 = 'A'
Boolean.Text.5 = ' User '
Boolean.Type.5 = 'U'
FType = 1
/* set up our string gadgets */
String.Num = 10
do i = 1 to String.Num
String.LeftEdge.i = 32
String.TopEdge.i = i * 16 + 15
String.Width.i = 59 * 8
String.GadgetID.i = i + 5 /* how we tell one gadget from another */
end
do i = 1 to (Boolean.Num * 10)
String.Buffer.i = '' /* null string */
end
/* open window */
w.LeftEdge = 0
w.TopEdge = 0
w.Width = 520
w.Height = 190
w.IDCMPFlags = 'CLOSEWINDOW + MENUPICK + GADGETUP'
w.Flags = 'WINDOWCLOSE + WINDOWDRAG + ACTIVATE + NOCAREFRESH + SMARTREFRESH'
w.Title = Title || ' by ' || Author
call OpenWindow(FHOST, w.LeftEdge, w.TopEdge, w.Width, w.Height, w.IDCMPFlags, w.Flags, w.Title)
/* first menu */
call AddMenu(FHOST, Title)
call AddItem(FHOST, 'Save', 'SAVE', 'S',,)
call AddItem(FHOST, 'Quit', 'QUIT', 'Q',,)
/* add text */
call SetAPen(FHOST, 1)
call SetBPen(FHOST, 0)
call SetDrMd(FHOST, 'JAM2')
call WhichFKeys(FType)
/* read old function key definitions */
call ReadFKeys()
/* open port */
call OpenPort(FPORT)
/* add gadgets */
do i = 1 to Boolean.Num
call AddGadget(FHOST, Boolean.LeftEdge.i, Boolean.TopEdge.i, Boolean.GadgetID.i, Boolean.Text.i, Boolean.GadgetID.i)
end
do i = 1 to String.Num
call AddGadget(FHOST, String.LeftEdge.i, String.TopEdge.i, String.GadgetID.i, String.Buffer.i, '%0'||String.GadgetID.i||'%1%g', String.Width.i)
end
call ActivateGadget(FHOST, String.GadgetID.1)
/* event loop & no we don't busy wait :-) */
looping = TRUE
do while (looping)
/* wait for something to happen */
call waitpkt(FPORT)
/* loop until no more messages */
do forever
packet = getpkt(FPORT)
if (packet = NULL()) then
break
msg = getarg(packet, 0)
arg1 = getarg(packet, 1) /* some msg won't have this */
call Reply(packet, 0)
/* find out what */
select
/* check for boolean gadget */
when ((msg >= 1) & (msg <= 5)) then do /* 1-Normal, 2-Shift, 3-CTRL, 4-ALT, 5-User */
FType = msg
do i = 1 to String.Num
call RemoveGadget(FHOST, String.GadgetID.i)
x = i + ((FType - 1) * String.Num)
call AddGadget(FHOST, String.LeftEdge.i, String.TopEdge.i, String.GadgetID.i, String.Buffer.x, '%0'||String.GadgetID.i||'%1%g', String.Width.i)
end
call WhichFKeys(msg)
call ActivateGadget(FHOST, String.GadgetID.1)
end
/* check for string gadget */
when ((msg >= '6') & (msg <= '16')) then do
/* copy gadget buffer to array */
i = msg - 5
x = i + ((FType - 1) * String.Num)
String.Buffer.x = arg1
/* activate the correct gadget */
if (msg < '15') then
call ActivateGadget(FHOST, String.GadgetID.i + 1)
else
call ActivateGadget(FHOST, String.GadgetID.1)
end
/* check for exit */
when (msg = 'SAVE') then do
call WriteFKeys()
looping = FALSE
end
/* geez, user wants out! */
when ((msg = 'CLOSEWINDOW') | (msg = 'QUIT')) then
looping = FALSE
otherwise
nop
end
end
end
/* close down */
do i = 1 to 5
call RemoveGadget(FHOST, i) /* boolean gadgets */
end
do i = 1 to String.Num
call RemoveGadget(FHOST, String.GadgetID.i) /* string gadgets */
end
call RemoveMenu(FHOST)
call CloseWindow(FHOST)
exit
/************************************************************************/
/* WhichFKeys */
/************************************************************************/
WhichFKeys: procedure expose FHOST Boolean. String.Num
arg Functype
do i = 1 to String.Num
call Move(FHOST, 4, i * 16 + 22)
call Text(FHOST, Boolean.Type.Functype || i)
end
return
/************************************************************************/
/* ReadFKeys */
/************************************************************************/
ReadFKeys: procedure expose String.
'EXTRACT [FUNCTIONKEY]'
do i = 1 to String.Num
j = i + 0
String.Buffer.j = VLT.FUNCTIONKEY.i
end
'EXTRACT [FUNCTIONKEYSHIFT]'
do i = 1 to String.Num
j = i + 10
String.Buffer.j = VLT.FUNCTIONKEYSHIFT.i
end
'EXTRACT [FUNCTIONKEYCTRL]'
do i = 1 to String.Num
j = i + 20
String.Buffer.j = VLT.FUNCTIONKEYCTRL.i
end
'EXTRACT [FUNCTIONKEYALT]'
do i = 1 to String.Num
j = i + 30
String.Buffer.j = VLT.FUNCTIONKEYALT.i
end
'EXTRACT [FUNCTIONUSERMENU]'
do i = 1 to String.Num
j = i + 40
String.Buffer.j = VLT.FUNCTIONUSERMENU.i
end
return
/************************************************************************/
/* WriteFKeys */
/************************************************************************/
WriteFKeys: procedure expose String.
/* tell VLT about the new definitions */
call PostMsg(0, 0, "Please Wait... Programming definitions", address())
do i = 1 to 50
/* build VLT command */
fkeycmd = 'F ' || i || ' [' || String.Buffer.i || ']'
/* tell VLT to do something! */
'""' || fkeycmd
end
call PostMsg()
msg = "New definitions are active. Use <Save Configuration> permanently store."
call PostMsg(0, 0, msg, address())
call Delay(250)
call PostMsg()
return